package IOstreams;

import java.io.*;
import java.io.File;

public class InputAndOutputStreamTest {
    public static void main(String[] args) {
        File file = new File("ChapterLearning/a.txt");
        try (
                FileInputStream in = new FileInputStream(file);
                FileOutputStream out = new FileOutputStream(new File("ChapterLearning/b.txt"))
        ) {
            byte[] bytes =  new byte[1024];
            int readCount = 0;
            while ((readCount = in.read(bytes)) != -1){
                out.write(bytes,0,readCount);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}
